<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
require "vendor/autoload.php";
$cosClient = new Qcloud\Cos\Client(["region" => "COS_REGION", "credentials" => ["secretId" => "COS_KEY", "secretKey" => "COS_SECRET"]]);
$bucket = "test2-1252448703";
$key = "a.txt";
$local_path = "E:/a.txt";
try {
    $result = $cosClient->putObject(["Bucket" => $bucket, "Key" => $key, "Body" => "Hello World!"]);
    print_r($result);
    echo $result["ETag"];
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->putObject(["Bucket" => $bucket, "Key" => $key, "Body" => fopen($local_path, "rb")]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->putObject(["Bucket" => $bucket, "Key" => $key, "Body" => fopen($local_path, "rb"), "ACL" => "string", "CacheControl" => "string", "ContentDisposition" => "string", "ContentEncoding" => "string", "ContentLanguage" => "string", "ContentLength" => integer, "cONTENTType" => "string", "Expires" => "mixed type: string (date format)|int (unix timestamp)|\\DateTime", "GrantFullControl" => "string", "GrantRead" => "string", "GrantWrite" => "string", "Metadata" => ["string" => "string"], "StorageClass" => "string"]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->upload($bucket = $bucket, $key = $key, $body = "Hello World!");
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->upload($bucket = $bucket, $key = $key, $body = fopen($local_path, "rb"));
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->upload($bucket = $bucket, $key = $key, $body = fopen($local_path, "rb"), $options = ["ACL" => "string", "CacheControl" => "string", "ContentDisposition" => "string", "ContentEncoding" => "string", "ContentLanguage" => "string", "ContentLength" => integer, "ContentType" => "string", "Expires" => "mixed type: string (date format)|int (unix timestamp)|\\DateTime", "GrantFullControl" => "string", "GrantRead" => "string", "GrantWrite" => "string", "Metadata" => ["string" => "string"], "StorageClass" => "string"]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $command = $cosClient->getCommand("putObject", ["Bucket" => $bucket, "Key" => $key, "Body" => ""]);
    $signedUrl = $command->createPresignedUrl("+10 minutes");
    echo $signedUrl;
} catch (Exception $e) {
    echo $e;
}
try {
    $command = $cosClient->getCommand("uploadPart", ["Bucket" => $bucket, "Key" => $key, "UploadId" => "", "PartNumber" => "1", "Body" => ""]);
    $signedUrl = $command->createPresignedUrl("+10 minutes");
    echo $signedUrl;
} catch (Exception $e) {
    echo $e;
}
try {
    $command = $cosClient->getCommand("putObject", ["Bucket" => $bucket, "Key" => $key, "Body" => ""]);
    $signedUrl = $command->createAuthorization("+10 minutes");
    echo $signedUrl;
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getObject(["Bucket" => $bucket, "Key" => $key]);
    echo $result["Body"];
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getObject(["Bucket" => $bucket, "Key" => $key, "SaveAs" => $local_path]);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getObject(["Bucket" => $bucket, "Key" => $key, "Range" => "bytes=0-10", "SaveAs" => $local_path]);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getObject(["Bucket" => $bucket, "Key" => $key, "ResponseCacheControl" => "string", "ResponseContentDisposition" => "string", "ResponseContentEncoding" => "string", "ResponseContentLanguage" => "string", "ResponseContentType" => "string", "ResponseExpires" => "mixed type: string (date format)|int (unix timestamp)|\\DateTime", "SaveAs" => $local_path]);
} catch (Exception $e) {
    echo $e;
}
try {
    $signedUrl = $cosClient->getObjectUrl($bucket, $key, "+10 minutes");
    echo $signedUrl;
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->deleteObject(["Bucket" => $bucket, "Key" => $key, "VersionId" => "string"]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->deleteObjects(["Bucket" => "string", "Objects" => [["Key" => $key, "VersionId" => "string"]]]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->headObject(["Bucket" => $bucket, "Key" => "11", "VersionId" => "111"]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->listBuckets();
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->createBucket(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->deleteBucket(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->headBucket(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->listObjects(["Bucket" => $bucket]);
    foreach ($result["Contents"] as $rt) {
        print_r($rt);
    }
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->listObjects(["Bucket" => $bucket, "Prefix" => "string"]);
    foreach ($result["Contents"] as $rt) {
        print_r($rt);
    }
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getBucketLocation(["Bucket" => "lewzylu02"]);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->putBucketVersioning(["Bucket" => $bucket, "Status" => "Enabled"]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->listObjectVersions(["Bucket" => $bucket, "Prefix" => "string"]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getBucketVersioning(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->putBucketAcl(["Bucket" => $bucket, "Grants" => [["Grantee" => ["DisplayName" => "qcs::cam::uin/327874225:uin/327874225", "ID" => "qcs::cam::uin/327874225:uin/327874225", "Type" => "CanonicalUser"], "Permission" => "FULL_CONTROL"]], "Owner" => ["DisplayName" => "qcs::cam::uin/3210232098:uin/3210232098", "ID" => "qcs::cam::uin/3210232098:uin/3210232098"]]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getBucketAcl(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->putObjectAcl(["Bucket" => $bucket, "Key" => $key, "Grants" => [["Grantee" => ["DisplayName" => "qcs::cam::uin/327874225:uin/327874225", "ID" => "qcs::cam::uin/327874225:uin/327874225", "Type" => "CanonicalUser"], "Permission" => "FULL_CONTROL"]], "Owner" => ["DisplayName" => "qcs::cam::uin/3210232098:uin/3210232098", "ID" => "qcs::cam::uin/3210232098:uin/3210232098"]]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getObjectAcl(["Bucket" => $bucket, "Key" => $key]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->putBucketLifecycle(["Bucket" => $bucket, "Rules" => [["Expiration" => ["Days" => 1000], "ID" => "id1", "Filter" => ["Prefix" => "documents/"], "Status" => "Enabled", "Transitions" => [["Days" => 200, "StorageClass" => "NEARLINE"]]]]]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getBucketLifecycle(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->deleteBucketLifecycle(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->putBucketCors(["Bucket" => $bucket, "CORSRules" => [["ID" => "1234", "AllowedHeaders" => ["*"], "AllowedMethods" => ["PUT"], "AllowedOrigins" => ["http://www.qq.com"]]]]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getBucketCors([]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->deleteBucketCors(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->putBucketReplication(["Bucket" => $bucket, "Role" => "qcs::cam::uin/327874225:uin/327874225", "Rules" => [["Status" => "Enabled", "ID" => "string", "Prefix" => "string", "Destination" => ["Bucket" => "qcs::cos:ap-guangzhou::lewzylu01-1252448703", "StorageClass" => "standard"]]]]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getBucketReplication(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->deleteBucketReplication(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->putBucketNotification(["Bucket" => $bucket, "CloudFunctionConfigurations" => [["Id" => "test-1", "Filter" => ["Key" => ["FilterRules" => [["Name" => "Prefix", "Value" => "111"], ["Name" => "Suffix", "Value" => "111"]]]], "CloudFunction" => "qcs:0:video:sh:appid/1253125191:video/10010", "Events" => ["Event" => "cos:ObjectCreated:*"]], ["Id" => "test-2", "Filter" => ["Key" => ["FilterRules" => [["Name" => "Prefix", "Value" => "111"], ["Name" => "Suffix", "Value" => "111"]]]], "CloudFunction" => "qcs:0:video:sh:appid/1253125191:video/10010", "Events" => ["Event" => "cos:ObjectRemove:*"]]]]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->getBucketNotification(["Bucket" => $bucket]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->copyObject(["Bucket" => $bucket, "CopySource" => "{bucket}.cos.{region}.myqcloud.com/{cos_path}?versionId={versionId}", "Key" => "string"]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->copy($bucket = $bucket, $key = $key, $copysource = "{bucket}.cos.{region}.myqcloud.com/{cos_path}", $options = ["VersionId" => "{versionId}"]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->restoreObject(["Bucket" => $bucket, "Key" => $key, "Days" => 7, "CASJobParameters" => ["Tier" => "Bulk"]]);
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $prefix = "";
    $marker = "";
    while (true) {
        $result = $cosClient->listObjects(["Bucket" => $bucket, "Marker" => $marker, "MaxKeys" => 1000]);
        foreach ($result["Contents"] as $rt) {
            print_r($rt["Key"] . " ");
        }
        $marker = $result["NextMarker"];
        if(!$result["IsTruncated"]) {
        }
    }
} catch (Exception $e) {
    echo $e;
}
try {
    while (true) {
        $result = $cosClient->listMultipartUploads(["Bucket" => $bucket, "Prefix" => ""]);
        if(count($result["Uploads"]) == 0) {
        } else {
            foreach ($result["Uploads"] as $upload) {
                try {
                    $rt = $cosClient->abortMultipartUpload(["Bucket" => $bucket, "Key" => $upload["Key"], "UploadId" => $upload["UploadId"]]);
                    print_r($rt);
                } catch (Exception $e) {
                    echo $e;
                }
            }
        }
    }
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->resumeUpload($bucket = $bucket, $key = $key, $body = fopen("E:/test.txt", "rb"), $uploadId = "152448808231afdf221eb558ab15d1e455d2afd025c5663936142fdf5614ebf6d1668e2eda");
    print_r($result);
} catch (Exception $e) {
    echo $e;
}
try {
    $result = $cosClient->listBuckets();
    foreach ($result["Buckets"] as $bucket) {
        $region = $bucket["Location"];
        $name = $bucket["Name"];
        if(startswith($name, "lewzylu")) {
            try {
                $cosClient2 = new Qcloud\Cos\Client(["region" => $region, "credentials" => ["secretId" => getenv("COS_KEY"), "secretKey" => getenv("COS_SECRET")]]);
                $rt = $cosClient2->deleteBucket(["Bucket" => $name]);
                print_r($rt);
            } catch (Exception $e) {
            }
        }
    }
} catch (Exception $e) {
    echo $e;
}
function startsWith($haystack, $needle)
{
    $length = strlen($needle);
    return substr($haystack, 0, $length) === $needle;
}

?>